9<template>
	 <div class="">
		<div class="usertop bluebg">
			<span class="usubtit">我的评价</span>
		</div>
		<div class="usermain">
			<div class="advbox">			
				<el-row class="advtit">
				  <el-col :span="8"><div class="">评价时间</div></el-col>
				  <el-col :span="12"><div class="">评价内容</div></el-col>
				  <el-col :span="4"><div class="">操作</div></el-col>
				</el-row>
				<div class="advlist" v-for="item of feedback" :key="item.id" :data="feedback.slice((currentpage-1)*pagesize,currentpage*pagesize)">
					<el-row class="advdoc">
					  <el-col :span="8"><div class="">{{item.create_time}}</div></el-col>
					  <el-col :span="12"><div class="doctit">{{item.content}}</div></el-col>
					  <el-col :span="4"><div class="flexcol delete"  @click="deleteItem(item.id)"><i class="iconfont iconshanchu1"></i><span>删除</span></div></el-col>
					</el-row>
			    </div>
			</div>
				<div class="userpage">
						<el-pagination
							background
							@current-change="handleCurrentChange"
							:current-page="currentpage"
							:page-size="pagesize"
							:hide-on-single-page="true"
							layout="prev, pager, next"
							:total="total">
						</el-pagination>
				</div>
		</div>
	 </div>
</template>
<script>
import storage from '../../../storage/index'

import axios from 'axios'
  export default {
    name: 'UserAdv',
    inject:['reload'],
    data(){
    	return{
    		feedback:[],
    		total:0,
    		currentpage:1,
        	pagesize:5,
    	}
    },
    methods:{
    		handleCurrentChange: function(currentpage){
                this.currentpage = currentpage;
                this.getAdvInfo(5,currentpage,1);
        	},
	    	getAdvInfo(a,b,c){	    		
                axios.get('/Feedback/index?limit='+a+'&page='+b+'&my='+c,{
                  query:{
                  	limit:a,
                  	page:b,
                  	my:c
                  }
                }).then((res)=>{

                  res = res.data
                  if (res.status==200) {
                    const data = res.data
                    console.log(data.data)
                    this.feedback = data.data
                    this.total = data.total
                  }            
                });
	    	},
	    	deleteItem(id){
	    		console.log(id)
	    		axios.get('/Feedback/delete?id='+id,{
                  query:{
                  	id
                  }
                }).then((res)=>{
                  if (res.status==200) {
                  	console.log(res)
                    this.message()
                    this.reload()
                   // this.getAdvInfo(5,1,1)
                  }            
                });
	    		
	    	},
	    	message() {
	          this.$message({
	            dangerouslyUseHTMLString: true,
	            message: '<p>删除成功!</p>',
	            center:true,
	            offset:300,
	            duration:1000,
	            type: 'success'
	          })
	        }
	},
	created (){
	    this.getAdvInfo(5,1,1)
	}  
  }
</script>

<style scoped>
	.usermain{
		padding:30px;
	}
	.advbox{
		height:508px;
	}
	.advtit{
	  font-size: 14px;
	  color: rgb(165, 165, 165);
	  line-height: 1.714;
	  font-weight: 100;
	}
	.advtit>div:last-child{
		text-align: center;
	}
	.advdoc{
		font-size: 14px;
		color:#333;
		font-weight: 400;
	}
	.doctit{
		font-size: 17px;
		font-weight: 500;
		height: 55px;
		overflow: hidden;
	}
	.delete{
		color: #bdbdbd;
		text-align: center;
	}
	.delete:hover{
		color:#0e79ed;
		cursor: pointer;
	}
	.advdoc .iconshanchu1{
		font-size: 30px;
	}
	.advdoc>div:last-child:hover
	.advlist h4{
		font-weight: 300;
		font-size: 14px;
	}
	.advlist p{
		font-size: 14px;
		color: #898888;
	}
	.advlist{
  		border-bottom: 1px dashed rgba(33, 84, 231,0.102);
  		padding-bottom: 15px;
  		margin-bottom: 25px;
	}
	div.userpage{
		text-align: center;
	}
</style>